#{extends 'main.html' /}
*{project}*<h2>${project.name}</h2>
<hr/><a href="@{Components.index(project.getEntityId())}">Components</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="@{Events.showProjectEvents(project.getEntityId())}">Events</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="@{Tasks.showAllProjectTasks(project.getEntityId())}">Tasks</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="@{UserStories.listStories(project.getEntityId())}">User Stories</a>
<hr/><h3>Project Details</h3>
Name: ${project.name}
<br>
Description: ${project.description}
<br>
Creation date: ${project.creationDate.getTime()}
<br>
Default Sprint duration: ${project.defaultSprintDuration} days
<br/>
#{if !isMember}
<br>
<br>
<a href="@{Projects.selectRoleInProject(project.getEntityId())}"><h2>Join This Project</h2></a>
<br>
<br>
#{/if}

<br/>
<br/>
<table>
    <div class="msg_list">
        <div class="msg_h">
            <h2 class="msg_head">Project Control</h2>
        </div>
        <div class="msg_body1">
        #{secure.check 'Edit my project'}
        <p style="background-color:#CECECE;" class="msg_head2">
            <a href="@{Projects.editInfoPage(project.getEntityId())}">Edit Info</a>
        </p>
        #{/secure.check}
		#{secure.check 'View the project backlog'}
        <p style="background-color:#CECECE;" class="msg_head2">
            <a href="@{ProductBacklog.viewBacklog(project.getEntityId())}">Product Backlog</a>
        </p>
        #{/secure.check}
        #{secure.check 'View the impediment log'}
        <p style="background-color:#CECECE;" class="msg_head2">
            <a href="@{ImpedimentLog.viewImpedimentLog(project.getEntityId())}">Impediment Log</a>
        </p>
        #{/secure.check}
        #{if controllers.Projects.canEditConfiguration(project)}
        <p style="background-color:#CECECE;" class="msg_head2">
            <a href="@{Projects.editConfPage(project.getEntityId())}">Edit Configuration</a>
        </p>
        #{/if}
        #{secure.check 'Add a Component'}
        <p style="background-color:#CECECE;" class="msg_head2">
            <a href="@{Projects.createComponentForm(project.getEntityId())}">Add a Component</a>
        </p>
        #{/secure.check}
        #{secure.check 'Invite guests to my project'}
        <p style="background-color:#CECECE;" class="msg_head2">
            <a href="@{Projects.selectRoleInProject(project.getEntityId(), true, false)}" >Invite a Guest</a>
        </p>
        #{/secure.check}
        #{secure.check 'Invite Users to the project'}
        <p style="background-color:#CECECE;" class="msg_head2">
            <a href="@{Projects.selectRoleInProject(project.getEntityId(), false, true)}" >Invite a User</a>
        </p>
        #{/secure.check}
        <p style="background-color:#CECECE;" class="msg_head2">
            <a href="@{UserRoleProjects.changeRoleRequest(project.getEntityId())}">Change Role</a>
        </p>
        <p style="background-color:#CECECE;" class="msg_head2">
            <a href="@{Projects.changeEffortUnit(project.getEntityId())}">Change metric of effort estimation</a>
        </p>
        #{secure.check 'Delete my project'}
        <p style="background-color:#CECECE;" class="msg_head2">
            <a href="javascript:showDialogHelper('Confirmation','Are you sure you want to delete this project?',true,'@{Projects.deleteProject(project.getEntityId())}','prompt');">Delete Project</a>
        </p>
        #{/secure.check}
        #{if isMember}
        <p style="background-color:#CECECE;" class="msg_head2">
            <a href="javascript:showDialogHelper('Confirmation','Are you sure you want to leave this project?',true,'@{Users.leaveProject(project.getEntityId())}','prompt');">Leave Project!</a>
        </p>
        #{/if}
        </div>
    </div>
</table>
<br/>
<br/>
<table>
    <div class="msg_list">
        <div class="msg_h">
            <h2 class="msg_head">Meetings & Sprints</h2>
        </div>
        <div class="msg_body1">
        <p style="background-color:#CECECE;" class="msg_head2">
            <a href="@{Events.createEvent(project.getEntityId())}">Create Event</a>
        </p>
        <p style="background-color:#CECECE;" class="msg_head2">
            <a href="@{Projects.createNotePage(project.getEntityId())}">Create Note</a>
        </p>
        #{secure.check 'Invite guests to my project'}
        <p style="background-color:#CECECE;" class="msg_head2">
            <a href="@{Projects.selectRoleInProject(project.getEntityId(), true, false)}">invite a Guest to Project</a>
        </p>
        #{/secure.check}
        #{secure.check 'Invite Users to the project'}
        <p style="background-color:#CECECE;" class="msg_head2">
            <a href="@{Projects.selectRoleInProject(project.getEntityId(), false, true)}">invite a User to Project</a>
        </p>
        #{/secure.check}
        <p style="background-color:#CECECE;" class="msg_head2">
            <a href="@{Events.Requests(project.id)}">Meeting Requests</a>
        </p>
        <p style="background-color:#CECECE;" class="msg_head2">
            <a href="@{Events.showSprints(project.getEntityId())}">View Sprints</a>
        </p>
        #{secure.check 'View the project backlog'}
        <p style="background-color:#CECECE;" class="msg_head2">
            <a href="@{Report.viewRetroReport(project.getEntityId())}">View Retrospective Reports</a>
        </p>
        #{/secure.check}
        #{secure.check 'View reports and statistics'}
        <p style="background-color:#CECECE;" class="msg_head2">
            <a href="@{Report.reportSelection(project.getEntityId())}">View Reports</a>
        </p>
        #{/secure.check}
        </div>
    </div>
</table>
<br>
<br>
<table>
    <div class="msg_list">
        <div class="msg_h">
            <h2 class="msg_head">Project Roles</h2>
        </div>
        <div class="msg_body1">
        #{secure.check 'Request to change my role in project'}
        <p style="background-color:#CECECE;" class="msg_head2">
            <a href="@{UserRoleProjects.changeRoleRequest(project.id)}">Request to Change my Role</a>
        </p>
        #{/secure.check}
        <p style="background-color:#CECECE;" class="msg_head2">
            <a href="@{Projects.getAllRoles(project.getEntityId())}">View roles in my project</a>
        </p>
        #{secure.check 'Grant/reject a Project Member role-request'}
        <p style="background-color:#CECECE;" class="msg_head2">
            <a href="@{UserRoleProjects.getAllRoleRequests(project.id)}">Respond to Role Requests</a>
        </p>
        #{/secure.check}
        </div>
    </div>
</table>
<script type="text/javascript">
    function swap(b, p){ //document.getElementById('b').disabled=true;
        document.getElementById(b).style.display = (document.getElementById(b).style.display == "none") ? "block" : "none";
        document.getElementById(p).src = (document.getElementById(b).style.display == "block") ? "/public/images/minus.gif" : "/public/images/plus.gif";
    }
</script>
